#!/bin/bash

#srcdir="/Users/jiangwen/Documents/dribbble/SignUp_files"  #[done]

srcdir="/Users/jiangwen/Documents/dribbble/Detail_files/"
files=`ls $srcdir`

for f in $files
do
    subfix=`echo $f | cut -d'.' -f2`
    if [ $subfix = "css" ] ; then
        if [ ! -f ./css/$f ] ; then
            echo "[import] css file: $f"
            cp $srcdir/$f ./css
        else
            echo "[exists] css file $f "
        fi
    fi

    if [ $subfix = "js" ] ; then
        if [ ! -f ./js/$f ] ; then
            echo "[import] js file: $f"
            cp $srcdir/$f ./js
        else
            echo "[exists] js file $f "
        fi
    fi

    if [ $subfix = "png" -o $subfix = "gif" -o $subfix = "jpg" ] ; then
        if [ ! -f ./images/$f ] ; then
            echo "[import] image file: $f"
            cp $srcdir/$f ./images
        else
            echo "[exists] image file $f "
        fi
    fi
done

svnnew=`svn st | awk '{print $2}'`
for f in $svnnew
do
    if [ ! $f = "sync.sh" ] ; then
        svn add $f
    fi
done

